<?php 

$nbC=$kpiData['nbC'];
$months=$kpiData['months'];
$types=$kpiData['types'];
$i=0;

?>
<h2 ><?php __('Number of Forms per month and per Status'); echo ' PRM10_KPI'  ?></h2>
<?php foreach($nbC as $nbKey => $nbVal):  ?>
<?php $nbT=$nbVal;  ?>
    <h3 class="showNextDiv pointer"><?php __($nbKey);  ?></h3>
    <div class="isHidden">
<table class="formstatus">
    
    <thead>
        <tr>
            <th><?php __('Demand Type')  ?></th>
            <?php foreach ($months as $monthKey => $monthVal):  ?>
            <th><?php __(strftime('%b',  strtotime("2000-$monthKey-01")))  ?></th>
            <?php endforeach;  ?>
            <th><?php __('Year : '.date('Y'))  ?></th>
            <th><?php __('Year N-1 : '.(date('Y')-1))  ?></th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($types as $typeKey => $typeVal): ?>
        <?php 
        if($i%2>0) $cls='impair'; else $cls='pair';
        ?>
        <tr class="<?php echo $cls  ?>">
            
            <td><?php __($typeVal)  ?></td>
            
            <?php foreach ($nbT[$typeKey] as $key => $val):  ?>
            
                <td class="<?php ($key=="n" || $key=="n-1")? e('total'): e('monthTd'); ?>">
                    
                    <?php if(strlen($val)>0) echo $val; else echo '0';  ?>
                    
                </td>
            <?php endforeach;  ?>
        </tr>
        <?php $i++  ?>
        <?php endforeach;  ?>
    </tbody>
</table>
</div>
<?php endforeach;  ?>